<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>提交</button>
    <script>
        let btn = document.querySelector('button')

        function debounce(fn,delay){
            let timer = null;
            return function(){
                if(timer){
                    clearTimeout(timer)
                }
                timer = setTimeout(()=>{
                    fn()
                },delay)
            }
        }
      
        btn.onclick = debounce(()=>{
            console.log('提交') 
        },1000)
    </script>
    
</body>
</html>